/*
 *  Copyright (C) 2009  Peter Kist & Jan Ripke
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


#include <boost/test/unit_test.hpp>

#include <OIS/OISKeyboard.h>

#include <input/OIS/KeyMapper.h>


using namespace galaxy::input;

BOOST_AUTO_TEST_SUITE( test_suite_input )

//--------------------------------------------------------
//  MAPPED KEY TEST
//--------------------------------------------------------

struct fixture_mapper_test {
    ois_input::KeyMapper mapper;

	fixture_mapper_test() {
	};
	~fixture_mapper_test() { };

};

BOOST_FIXTURE_TEST_CASE(KeyMapperTest, fixture_mapper_test) {
    ois_input::MappedKey mappedKey_a(OIS::KC_A, 0);
    ois_input::MappedKey mappedKey_a_shift(OIS::KC_A, static_cast<int>(OIS::Keyboard::Shift));
    ois_input::MappedKey mappedKey_a_shift_alt(OIS::KC_A, static_cast<int>(OIS::Keyboard::Shift | OIS::Keyboard::Alt));

    BOOST_CHECK (mapper.getAction(mappedKey_a) == INPUT_KEYACTION_KEY);
    BOOST_CHECK (mapper.getAction(OIS::KC_A, 0) == INPUT_KEYACTION_KEY);

    BOOST_CHECK (mapper.linkMappedKeyToAction(mappedKey_a, INPUT_KEYACTION_EXIT) == true);
    BOOST_CHECK (mapper.linkMappedKeyToAction(mappedKey_a_shift, INPUT_KEYACTION_FORWARD) == true);

    BOOST_CHECK (mapper.getAction(mappedKey_a) == INPUT_KEYACTION_EXIT);
    BOOST_CHECK (mapper.getAction(mappedKey_a_shift) == INPUT_KEYACTION_FORWARD);
    BOOST_CHECK (mapper.getAction(mappedKey_a_shift_alt) == INPUT_KEYACTION_KEY);
}

//--------------------------------------------------------
//  ANOTHER TEST
//--------------------------------------------------------


//--------------------------------------------------------
//  YET ANOTHER TEST TEST
//--------------------------------------------------------


BOOST_AUTO_TEST_SUITE_END()
